{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 预处理脚本"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### --------------Args------------\n",
    "- dataset_type：指定数据集类型（Train/Test）\n",
    "- xml2mask：是否执行xml转mask（True/False）\n",
    "- checkWSI：是否检查WSI文件正确性（True/False）\n",
    "- balance_extraction：是否平衡抽取（True/False）\n",
    "- train_wsi_dir：存储训练集WSI的目录，默认define.TRAIN_DATASET\n",
    "- test_wsi_dir：存储测试集WSI的目录，默认define.VALIDATION_DATASET"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'DATASET_DIR' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m/home/ramsley/prostate_PRE/preprocess_refine.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      6\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0m__future__\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mprint_function\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      7\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mglob\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 8\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mdefine\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      9\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     10\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0msys\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/home/ramsley/prostate_PRE/define.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m     29\u001b[0m \u001b[0;31m#根目录\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     30\u001b[0m \u001b[0mDATASET\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m'/home/ramsley/DataSet/prostate/1-4/'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 31\u001b[0;31m \u001b[0mPUBLIC_TRAIN_DATASET\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mDATASET_DIR\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;34m'trainingData/'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     32\u001b[0m \u001b[0mPUBLIC_VALIDATION_DATASET\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mDATASET_DIR\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0;34m'testingData/'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     33\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mNameError\u001b[0m: name 'DATASET_DIR' is not defined"
     ]
    }
   ],
   "source": [
    "%run ./preprocess_refine.py\\\n",
    " --dataset_type=Train\\\n",
    " --xml2mask=True\\\n",
    " --checkWSI=True\\\n",
    " --balance_extraction=True\\\n",
    " --train_wsi_dir=define.TRAIN_DATASET\\\n",
    " --test_wsi_dir=define.VALIDATION_DATASET"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
